package cn.wzvtc.ch10findby.repository;

import cn.wzvtc.ch10findby.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserRepository extends JpaRepository<User, Long> {
    //根据code自定义查询
    User findByCode(String code);

    List<User> findByUserNameLike(String userName);

    List<User> findByGender(Integer gender);

    List<User> findByUserNameAndGenderAndAgeBetween(String userName, Integer gender,
                                                    Integer minAge, Integer maxAge);

}
